<include file="Base:common_head" />
<div id="bd">
    <div class="left1">
        <include file="User:leftmenu" />
    </div>
    <div class="right1">
    	<div class="form">
        	<form action="__URL__/update_do" method="post">
            	<h3>用户资料编辑</h3>
                <ul>
                <li><label>用户名</label><input type="text" style="margin-right:10px;" id="name" name="name" value="{$Think.session.name}"/><div id="namecheck" ></div></li>
                <li><label>手机号码</label><input style="margin-right:10px;" type="text" name="phone" value="{$Think.session.phone|substr=0,3}*****{$Think.session.phone|substr=8,3}" /><a href="__URL__/changephone">更换手机</a></li>
                <li><label>QQ</label><input type="text" id="qq" name="qq" value="<empty name='Think.session.qq'>未填写<else/>{$Think.session.qq}</empty>" /></li>
                <li><input type="submit" class="btn" value="保存" /></li>
                </ul>
            </form>
            <script type="text/javascript">
				if($("#qq").val()=="未填写") $("#qq").css("color","#999");
				$("#qq").focus(function(){
					if($(this).val()=="未填写") $(this).val("").css("color","#000");
					});
				$("#qq").blur(function(){
					if($(this).val()=="") $(this).val("未填写").css("color","#999");
					});	
				$("#name").blur(function(){
					if($(this).val()!="{$Think.session.name}"){
						$.post("__APP__/Public/checkname",{'name':$(this).val()},function(data){
								if(data.info=="用户名存在"){
								img="style='background:url(/Public/images/no.gif) no-repeat 0 center; height:30px; line-height:30px; padding-left:19px;'";
								$(".btn").attr("disabled",true);
								showinfo="该用户名已被注册";
								}
								else if(data.info=="用户名不存在"){
									img="style='background:url(/Public/images/ok.gif) no-repeat 0 center; height:30px; line-height:30px; padding-left:19px;'";
									showinfo="用户名可用";
									} 
								$("#namecheck").html("<span "+img+">"+showinfo+"</span>");
							},'json');
						}
					else{
						$(".btn").removeAttr("disabled");
						$("#namecheck").html("");
						}	
					});	
			</script>
        </div>
    </div>
</div>
</body>
</html>
